package com.dongbao.core.rules.java;

import com.dongbao.core.base.CodeRulesCommonBase;
import com.dongbao.core.rules.CodeRulesBase;
import com.dongbao.entity.AwardedInfo;
import com.intellij.lang.jvm.JvmParameter;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.PsiClassImpl;

import java.util.Arrays;
import java.util.List;

/**
 *  变量符合小驼峰命名，达到名字即注释的效果
 * */
public class SmallHumpRules extends CodeRulesCommonBase implements CodeRulesBase {

    private List<String> errorName = Arrays.asList("hashMap","arrayList","list","map");

    public SmallHumpRules(VirtualFile afterFile, PsiFile psiFile, Project project) {
        super(afterFile,psiFile,project);
        this.code = "B004";
        this.level = "B";
    }

    /**
     * 执行规则判断
     * */
    @Override
    public void run(List<AwardedInfo> deduction) {
        /* 执行分析当前class是否负责当前规则 */
        PsiAnnotation[] annotations = psiClassImpls.get(0).getModifierList().getAnnotations();
//        for(PsiClassImpl psiClass:psiClassImpls){
//            /* 排除接口类 */
//            if(psiClass.getClass().isInterface()){
//                continue;
//            }
//            /* 获取所有方法 */
//            List<PsiMethod> ownMethods = psiClass.getOwnMethods();
//            for(PsiMethod method:ownMethods){
//                PsiStatement[] statements = method.getBody().getStatements();
//                PsiElement[] children = method.getBody().getChildren();
//            }
//        }
    }

    @Override
    public String describe() {
        return "命名规则";
    }
}
